package model

import "gitee.com/zaiqiang231/zcamp-service-camp/app/model/meta"

type PostComment struct {
	meta.RecordModel
	CID            uint64 `gorm:"column:comment_id"`          //评论唯一id
	PostID         uint64 `gorm:"column:post_id"`             //帖子id
	PostUID        uint64 `gorm:"column:post_uid"`            //帖子作者uid
	UID            uint64 `gorm:"column:uid"`                 //发布评论的用户id
	Content        string `gorm:"column:content"`             //评论内容(json格式,方便扩展)
	CommentType    uint16 `gorm:"column:type"`                //评论类型，1表示评论，2表示回复，0是异常评论
	ReplyUid       uint64 `gorm:"reply_uid;default:0"`        //被评论的uid，回复别人时不为0，评论时为0
	ReplyCommentId uint64 `gorm:"reply_comment_id;default:0"` //回复id
	FatherCid      uint64 `gorm:"father_cid;default:0"`       //回复的回复id
	Status         uint8  `gorm:"column:review_status;default:0"`
}

func (PostComment) TableName() string {
	return "z_post_comment"
}

type CommentDetails struct {
	CommentId    string         `json:"comment_id,omitempty"`    //评论id
	CommentUid   uint64         `json:"comment_uid,omitempty"`   //评论用户的uid
	PostID       string         `json:"post_id"`                 //帖子id
	PostUID      uint64         `json:"post_uid"`                //帖子作者uid
	Content      string         `json:"content"`                 //评论内容
	ReplyContent []ReplyContent `json:"reply_content,omitempty"` //回复的详情内容
	HasMore      bool           `json:"has_more"`                //回复是否还有下一页，true是，false否
	LikeNum      int            `json:"like_num"`
	LikeStatus   int            `json:"like_status"`
	CTime        int64          `json:"create_time,omitempty"`
	UserInfo     UserInfo       `json:"user_info"`
}

type ReplyContent struct {
	ReplyCommentId       string   `json:"reply_comment_id,omitempty"` //回复的唯一id
	ReplyInfo            UserInfo `json:"reply_info,omitempty"`       //回复发起方的信息
	BeRepliedInfo        UserInfo `json:"be_replied_info,omitempty"`  //被回复方的信息
	ReplyMsg             string   `json:"reply_msg,omitempty"`
	ReplyLikeNum         int      `json:"reply_like_num"`
	ReplyType            int      `json:"reply_type"` //2-回复评论，3-回复回复
	ReplyLikeStatus      int      `json:"reply_like_status"`
	ReplyCreateTime      int64    `json:"reply_create_time,omitempty"`
	ReplyFatherCommentId uint64   `json:"reply_father_commentid,omitempty"` //上级评论或回复id
}

type PostCommentLike struct {
	meta.RecordModel
	CID            uint64 `gorm:"column:comment_id"` //评论唯一id
	ReplyCommentId uint64 `gorm:"column:reply_comment_id"`
	CommentType    uint64 `gorm:"column:type"`
	UID            uint64 `gorm:"column:uid"` //评论唯一id
	IsDelete       uint8  `gorm:"column:is_delete;default:0"`
}

func (PostCommentLike) TableName() string {
	return "z_post_comment_like"
}
